<%@ page import="com.resataurant.Entity.Dish" %>
<%@ page import="java.util.List" %>
<%@ page import="com.resataurant.Service.AdminService" %>
<%@ page import="com.resataurant.Service.Impl.AdminServiceImpl" %><%--
  Created by IntelliJ IDEA.
  User: 86138
  Date: 2024/5/24
  Time: 上午10:18
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>餐厅管理系统登录解密</title>
    <!-- 新 Bootstrap 核心 CSS 文件 -->
    <!-- 新 Bootstrap 核心 CSS 文件 -->
    <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

    <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>

    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <%--<link href="back.css" rel="stylesheet" type="text/css" />--%>
</head>
<body>
<%
    String result=(String) request.getSession().getAttribute("res");
    List<Dish> list=null;
    if(result!=null){
        list = (List<Dish>) request.getSession().getAttribute("list");
    }else {
        AdminService adminService = new AdminServiceImpl();
        list = adminService.searchDish();
    }
    request.getSession().removeAttribute("res");
%>
<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <nav class="navbar navbar-default" role="navigation">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button> <a class="navbar-brand" href="#">查询结果</a>
                </div>
                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                    <ul class="nav navbar-nav">
                        <form class="navbar-form navbar-left" role="search" method="post">
                            <button type="button" class="btn btn-default"><a href="manager.jsp">返回管理界面</a></button>
                        </form>
                    </ul>
                </div>
            </nav>

            <%

                int i=0;
                for (Dish dish : list) {

                    i++;
                    if(i%3==0){
                        out.write("<div class=\"row\">");

                    }
                    out.write(" <div class=\"col-md-4\">\n" +
                            "                    <div class=\"thumbnail\">");


                    out.write(" <img style=\"width: 300px;height: 200px\" alt=\"300x200\" src=\""+dish.getDishImage()+"\"/>");
                    out.write("  <div class=\"caption\">");
                    out.write(" <h3>\n" +
                            dish.getDishName()+
                            "                            </h3>");

                    out.write("   <p>\n" +
                            dish.getDishContent()+
                            "                            </p>");


                    out.write(" <p>\n" +
                            "                                <label>价格：</label>"+dish.getDishPrice() +
                            "                            元</p>");

                    out.write("<p>\n" +
                            "                                <a class=\"btn btn-primary\" href=\"dishDetail.jsp?id="+dish.getDishId()+"\">查看详情</a>\n" +
                            "                            </p>");
                    out.write("</div>");
                    out.write("</div>");
                    out.write("</div>");
                    if(i%3==0){
                        out.write("</div>");

                    }

                }

            %>
        </div>
    </div>
</div>
</body>
</html>
